package com.chenyun.common.enums;

/**
 * 查询条件的枚举
 * @author lonni
 */
public enum ConditionEnum {
    eq("eq","等于"),
    ne("ne","不能于"),
    lt("le","小于"),
    le("lt","小于等于"),
    gt("ge","大于"),
    ge("gt","大于等于"),
    like("like","全模糊匹配"),
    llike("llike","左模糊匹配"),
    rlike("rlike","右模糊匹配"),
    between("between","范围查询"),
    in("in","包含")
    ;

    ConditionEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    // 根据value返回枚举类型,主要在switch中使用
    public static ConditionEnum getByValue(String value) {
        for (ConditionEnum code : values()) {
            if (value.equals(  code.getCode()) ) {
                return code;
            }
        }
        return null;
    }


}
